<script type="text/javascript" src="<? echo base_url();?>/assets/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">

function reply_message() {
         
      
      var sender_name="<?php echo $this->session->userdata('username'); ?>";	      
     
       var message= $('#message').val();  

      var append_data='<div class="message_name" > '+sender_name+'</div><div class="message_text">'+ message+'</div><br>';
           
          
           $.ajax({
		url: "<?php  echo site_url('profile/reply_message'); ?>",	
		type: "POST",		
		data: "message="+message,		
		cache: false,
		success: function (html) {	
		            
			$('#append_reply_msg').append(append_data);
                        $('#message').val("");	
		}		
	});


 
  }




</script>
<div id="content">
    
    
    <div id="middleColumn" style="text-align:left;">    


   
    	<?php  
		
		        if(!empty($records))
				{
				foreach ($records->result() as $row)
				{
					$sender = $row->sender_name;
					//$sub = $row->subject;
					$message = str_replace("\'","'",$row->message);
                                        $reciver_id=$row->sender_id;
                                        
				}
				}
		?>
      

<div  id="invite_friends_box" ><br>
  <?php
    if(!empty($records))
	{
    foreach ($records->result() as $row)
     {
          $message = str_replace("\'","'",$row->message);
        echo'<div class="message_name" > '.$row->sender_name.'</div>'; 
        echo'<div class="message_text">'. $message.'</div><br>';
                 $message_id=$row->map_id_for_messages; 
     }
   }	 
  ?>
<div id="append_reply_msg"></div>
</div>
 <br>
                

<textarea rows="2" cols="60" id="message" class="reply_msg_textarea" >

</textarea>
<div  class="reply_button"><input type="submit" value="reply" onClick="reply_message();" /></div>


              
           
</div>
</div>
